package com.dev;
import android.view.View;
import android.graphics.Paint;
import android.graphics.Canvas;
import android.graphics.drawable.StateListDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.Path;
import android.app.Application;
public class ShowSoftInput extends IconView{
	Paint p=new Paint();
	int contentL,contentT,contentR,contentB;
    public ShowSoftInput(MainActivity ma){
		super(ma);
		p.setColor(0xff7f7f7f);
		p.setStyle(Paint.Style.STROKE);
		StateListDrawable sd=new StateListDrawable();
		sd.addState(new int[]{android.R.attr.state_pressed},new ColorDrawable(0x77888888));
		setBackground(sd);
		//p.setStrokeJoin(Paint.Join.MITER);
		//p.setStrokeCap(Paint.Cap.SQUARE);
	}
	@Override
	protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
		super.onMeasure(widthMeasureSpec,heightMeasureSpec);
		contentL=getMeasuredWidth()/5;
		contentT=getMeasuredHeight()/3;
		contentR=getMeasuredWidth()-contentL;
		contentB=getMeasuredHeight()*3/4;
	}
	@Override
	protected void onDraw(Canvas canvas){
		super.onDraw(canvas);
		p.setStrokeWidth(getHeight()/34);
		canvas.drawLine(contentL,contentB,contentL,contentT,p);
		canvas.drawLine(contentL,contentT,contentR,contentT,p);
		canvas.drawLine(contentR,contentT,contentR,contentB,p);
		canvas.drawLine(contentL,contentB,contentR,contentB,p);
		for(int z=0;z<3;z++){
			int y=contentT+(contentB-contentT)*(z+1)/4;
			canvas.drawLine(contentL,y,contentR,y,p);
		}
		int y3=contentT+(contentB-contentT)*3/4;
		for(int z=1,y1=contentT+(contentB-contentT)/4,y2=contentT+(contentB-contentT)*2/4,cells=6;z<=cells;z++){
			int x=contentL+(contentR-contentL)*z/cells;
			canvas.drawLine(x,contentT,x,y1,p);
			canvas.drawLine(x,y2,x,y3,p);
			if(z==2){
				canvas.drawLine(x,y3,x,contentB,p);
			}else if(z==4){
				canvas.drawLine(x,y3,x,contentB,p);
			}
			x-=(contentR-contentL)/2/cells;
			if(z<cells){
				canvas.drawLine(x,y1,x,y2,p);
			}
		}
		Path path=new Path();
		//path.setFillType(Path.FillType.
		path.moveTo(getWidth()/2,contentT);
		path.quadTo(getWidth()/3,contentT/2,getWidth()*2/3,contentT/2);
		canvas.drawPath(path,p);
	}
}
